﻿<?php

require_once('./lastRSS.php');

if(isSet($_GET["url"]) && $_GET["url"] != ""){
  $url = $_GET["url"];

  $rss = new lastRSS;
  $rss->cache_dir = './rsscache'; 
  $rss->cache_time = 3600;
  $rss->cp = "UTF-8";

  $str = "";
  if ($rssArr = $rss->get($url)) {
    foreach($rssArr['items'] as $row){
      $str .= $row['title'] . "\n";
      $str .= $row['pubDate'] . "\n";
      $str .= $row['link'] . "\n";
      $str .= $row['description'] . "\n\n";
    }
    echo rtrim($str);
  }
  else {
    die ("error");
  }
}
else{
  echo "error";
}
?>